package day02;

import java.util.ArrayList;
import java.util.Arrays;

/**
 * Created by Administrator on 2023/6/30 0030.
 */
public class DoubleSpace {
    public static void main(String[] args) {
        int[] a = new int[2];
        for (int i = 0; i < 1000; i++) {
            //ensureCapacity
            if(i>=a.length){
                int []b=new int[a.length*2];
                for(int j=0;j<a.length;j++){
                    b[j]=a[j];
                }
                a=b;
            }
            a[i] = i;
        }
        System.out.println(Arrays.toString(a));
        ArrayList<Integer> arrayList;
    }
}
